<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="./node_modules/axios/dist/axios.js"></script>
    <script>
      const fetchData = async url => {
        if (url !== 'http://localhost:9999/goods') {
          return await axios.get(url)
        } else {
          return Promise.reject(new Error('错误'))
        }
      }
      Promise.allSettled([
        fetchData('http://localhost:9999/users'),
        fetchData('http://localhost:9999/goods'),
        fetchData('http://localhost:9999/carts'),
        fetchData('http://localhost:9999/userInfo')
      ]).then(res => {
        console.log('res:', res)
      })

      // Promise.all([
      //   fetchData('http://localhost:9999/users'),
      //   fetchData('http://localhost:9999/goods'),
      //   fetchData('http://localhost:9999/carts'),
      //   fetchData('http://localhost:9999/userInfo')
      // ]).then(res => {
      //   console.log('res:', res)
      // })
    </script>
  </body>
</html>
